<template>
  <div class="movie-detail-page">
      <h1>这是详情页</h1>
      <div class="movie-info">
            <p>{{ item.medicine_id }}</p>
            <p>{{ item.medicine_name }}</p>
            <p>{{ item.type === 0 ? '西药' : '中成药' }}</p>
            <p>{{ item.specifications }}</p>
            <p>{{ item.stock }}</p>
            <p>{{ item.unit }}</p>
            <p>{{ item.price.toFixed(2) }}</p>
            <p>{{ item.caution }}</p>
      </div>
  </div>
</template>

<script setup>
// 修正导入语句，去掉空格
import { useRoute } from 'vue-router';
// 导入 axios
import axios from 'axios';
const route = useRoute();
let id = route.params.mid;
const url = "/medicine/findById?medicineId=" + id;
import { ref } from 'vue';
const item = ref({});
axios.get(url).then((response) => {
  item.value = response.data;
});
</script>

<style scoped>
.movie-detail-page {
  padding: 20px;
  background-color: #f4f4f9;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.movie-detail-page h1 {
  font-size: 32px;
  font-weight: bold;
  text-align: center;
  color: #333;
  margin-bottom: 20px;
}

.movie-info {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

.movie-poster {
  text-align: center;
  margin-bottom: 20px;
}

.movie-poster img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.movie-name,
.movie-director {
  font-size: 18px;
  color: #333;
  margin-bottom: 10px;
}

.movie-name {
  font-weight: bold;
}
</style>    